<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <!-- 组件的使用 -->
        <button-counter></button-counter>
        <button-counter></button-counter>
        <button-counter></button-counter>
    </div>
    <script src="../js/vue.min.js"></script>
    <script>
        // 组件定义
        Vue.component('button-counter', {
            // 内部数据使用函数
            data: function() {
                return {
                    count: 0
                }
            },
            // 多一个模板
            template: '<button @click="handle">点击了{{count}}次</button>',
            methods: {
                handle: function() {
                    this.count++
                }
            }
        });
        // 其实也是个组件
        let vm = new Vue({
            el: "#app",
            data: {

            }
        })
    </script>
</body>

</html>